<?php
        require_once('../../Inc/Global.php');
        require_once('ConnectData.php');

switch($_REQUEST['action'])
{
		//To return a blank form
        case 'new':
                $rs = NewConnectMeth();
                include 'EditConnectMeth.php';
                break;      
        case 'edit':
        		$rs = GetConnectMeth($_REQUEST['id']);
                include 'EditConnectMeth.php';
                break;
        case 'save':
                $rs = $_REQUEST;
                $errors = ValidateConnectMeth($rs);
                if(!$errors)
                        if(isset($rs['ID']))
                                $errors = SaveConnectMeth($rs);
                        else
                                $errors = AddConnectMeth($rs);
                if(!$errors)
                {
                        $rs = GetConnectMeth($rs['ID']);
                        include 'Row.php';
                        die();
                }
                include 'EditConnectMeth.php';
                break;          
        case 'prompt_delete':
                break;
        case 'delete':
                $errors = DeleteConnectMeth($_REQUEST['ID']);
                if($errors)
                {
                	echo json_encode($errors);
                }
                else
                {
                	echo 'Success';
                }
                break;
}
